package org.hk.basic.studyspring;

public class TestInterface {
    public static void main(String[] args) {
        Person person = new Person();
        person.clean();
    }
}
class Person{
    WashAndCleanAgreement washAndCleanAgreement = new Worker();
    public String name;
    public void clean(){
        //如果找到了钟点工就钟点工干，找不到自己干
        if(washAndCleanAgreement==null){
            System.out.println("自己干");
        }else {
            washAndCleanAgreement.clean();
        }
    }
    public void washClothes(){
        washAndCleanAgreement.washClothes();
    }
    public void cook(){
    }
}
interface  AllAgreement{
    public void clean();
    public void washClothes();
    public void cook();
}
interface  WashClothesAgreement{
    public void washClothes();
}
interface  CookAgreement{
    public void washClothes();
}
interface  WashAndCleanAgreement{
    public void clean();
    public void washClothes();
}
class Worker implements AllAgreement,WashClothesAgreement,CookAgreement,WashAndCleanAgreement{
    public String name;
    public void clean(){
        System.out.println("打扫卫生");
    }
    public void washClothes(){
        System.out.println("洗衣服");
    }
    public void cook(){
        System.out.println("做饭");
    }
}
